package com.takeoff.bluewhale.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.NonNull;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.takeoff.bluewhale.interceptor.LoginCheckInterceptor;


@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private ObjectMapper objectMapper;

    @Override
    public void addInterceptors(@NonNull InterceptorRegistry registry) {
        // registry
        //         // 1： 拦截器注册
        //         .addInterceptor(new LoginCheckInterceptor(objectMapper))
        //         // 2: 给拦截器配置并且定义规则
        //         .addPathPatterns("/v?/**").excludePathPatterns("/v3/api-docs/**","/v3/api-docs");
    }
}
